<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>修改文章</title>
	<link rel="stylesheet" href="layui/css/layui.css">
	<link rel="stylesheet" href="css/home.css">
	<meta name="viewport"
	          content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes"/>
	<link rel="stylesheet" href="https://unpkg.com/mditor@1.0.5/dist/css/mditor.min.css" />
	<script src="https://unpkg.com/mditor@1.0.5/dist/js/mditor.min.js"></script>
	<script src="layui/layui.js" type="text/javascript" charset="utf-8"></script>
</head>

<body>

<div id="header">
	<div class="nav">
		<a href="#" class="logo">Lee Blog</a>
		<div id="nav-btn" class="btn">
			<i id="btn" class="layui-icon layui-icon-addition"></i>
		</div>
		<ul class="nav-bar">
			<li><a href="home.html" th:href="@{/admin}">首页</a></li>
			<li><a href="technology.html" th:href="@{/write}">写文章</a></li>
			<li><a href="life.html" th:href="@{/writeTime}">记录时间</a></li>
		</ul>
	</div>
</div>

<div class="layui-fluid btn-nav">
	<ul>
		<li><a href="home.html" th:href="@{/admin}">首页</a></li>
		<li><a href="technology.html" th:href="@{/write}">写文章</a></li>
		<li><a href="life.html" th:href="@{/writeTime}">记录时间</a></li>
	</ul>
</div>

<div class="layui-fluid" style="margin-top: 25px;">
	<form action="" th:action="@{/doEdit}" method="post" class="layui-form">

		<input type="hidden" name="id" th:value="${articleById.id}">
		
		<div class="layui-form-item layui-anim layui-anim-up">
		    <label class="layui-form-label">文章名称</label>
		    <div class="layui-input-block">
		        <input type="text" th:value="${articleById.title}" name="title" required  lay-verify="required" placeholder="请输入文章名称" autocomplete="off" class="layui-input">
		    </div>
		</div>

		<div class="layui-form-item layui-form-text layui-anim layui-anim-up">
		    <label class="layui-form-label">文章摘要</label>
		    <div class="layui-input-block">
		        <textarea name="desc" th:text="${articleById.desc}" required lay-verify="required" placeholder="请输入文章摘要" class="layui-textarea"></textarea>
		    </div>
		</div>
		
		<div class="layui-form-item">
		    <label class="layui-form-label">文章类型</label>
		    <div class="layui-input-block">
		      <select name="type" lay-verify="required" th:value="${articleById.type}">
		        <option value=""></option>
		        <option th:selected="${articleById.type == '技术' ? true : false}" value="技术">技术</option>
		        <option th:selected="${articleById.type == '杂记' ? true : false}" value="杂记">杂记</option>
		      </select>
		    </div>
		</div>
		  
		<div class="layui-form-item layui-anim layui-anim-up">
		    <label class="layui-form-label">文章标签</label>
		    <div class="layui-input-block">
		        <input type="text" th:value="${articleById.label}" name="label" required  lay-verify="required" placeholder="请输入文章标签" autocomplete="off" class="layui-input">
		    </div>
		</div>
		
		<div class="layui-form-item layui-form-text layui-anim layui-anim-up">
		    <label class="layui-form-label">文章内容</label>
		    <div class="layui-input-block">
		        <textarea name="content" th:text="${articleById.content}" id="editor" required lay-verify="required" placeholder="请输入文章内容" class="layui-textarea"></textarea>
		    </div>
		</div>
		
		<div class="layui-form-item layui-anim layui-anim-up">
		    <div class="layui-input-block">
		        <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
		    </div>
		</div>
	</form>
</div>


<script type="text/javascript">
	var mditor =  Mditor.fromTextarea(document.getElementById('editor'));
</script>
<script>
//Demo
layui.use('form', function(){
	var form = layui.form;
});
</script>

</body>
</html>